DOORS Performance Benchmark

I have written a small DXL script that measures the time to perform basic operations in DOORS client (open module, switch view, save and close). These operations are repeated inside a loop, to compute average values. (See below DXL code).

I am attaching the resulting graph. I am quite puzzled by the shape of the plot. If I repeat these 4 operations on the same module for a long time (around 3 hours on my machine), they take longer and longer, and the deviation also increases.

Do you have an explaination for this behaviour ? Could it come from my script, or is it typical DOORS behaviour ?

Thanks for sharing your thoughts on this topic.

Best regards,

Servanne.
 

// To benchmark a repetitive piece of code.
 
/**
 * Created by: a0918445
 * Creation date: Jan 23, 2012
 *
 * Texas Instruments Inc.
 */
 
/***************************/
/**        CONFIG          */
/***************************/  
 
const int NBITER = 20 
 
const bool STAT = true                  // Compute average values
 
const bool LOG = true                   // Output results to text file
 
/***************************/
/** Global Variables       */
/***************************/
 
Array results = create (NBITER, 1)              // 2-D array : x = iterations, y = steps
                                                                                // x = 0 : headings, y = 0 : not used
int step = 0
 
Module m
 
Stream logfile
 
/***************************/
/**      FUNCTIONS        **/
/***************************/
 
// This function prints the input string to the shell or to the log file depending on LOG constant flag.
 
bool printOut (string str)
{
if (LOG)
        logfile << str
else
        print str
        
return  
        
}
 
real benchmarkFileOpenShare (string file)
{
        put (results, "Open", 0, step)
        int startTime = getTickCount_() 
        
        /** Start of code to benchmark **/
        m = share (file, true)
        /** End of code to benchmark **/
        
//      int stopTime = getTickCount_() 
        real ms = getTickCount_() - startTime
        
        return (ms / 1000.0)
}
 
real benchmarkFileOpenExclu (string file)
{
        put (results, "Open", 0, step)
        int startTime = getTickCount_() 
        
        /** Start of code to benchmark **/
        m = edit (file, true)
        /** End of code to benchmark **/
        
        real ms = getTickCount_() - startTime
        
        return (ms / 1000.0)
}
 
real benchmarkLoadView (string viewName)
{
        put (results, "View", 0, step)
        int startTime = getTickCount_() 
        
        /** Start of code to benchmark **/
        load (view viewName)
        /** End of code to benchmark **/
        
        real ms = getTickCount_() - startTime
        
        return (ms / 1000.0)
}
 
real benchmarkFileSave ()
{     
        put (results, "Save", 0, step)
        int startTime = getTickCount_() 
        
        /** Start of code to benchmark **/
        save(m)
        /** End of code to benchmark **/
        
        real ms = getTickCount_() - startTime
        
        return (ms / 1000.0)    
}
 
real benchmarkFileClose ()
{    
        put (results, "Close", 0, step)
        int startTime = getTickCount_() 
        
        /** Start of code to benchmark **/
        close (m)
        /** End of code to benchmark **/
        
        real ms = getTickCount_() - startTime
        
        return (ms / 1000.0)
}
 
/** Function to convert Real to String, to display less decimal digits **/
/** Copied from DXL Forum : https://www.ibm.com/developerworks/forums/thread.jspa?threadID=361148&tstart=0 **/
 
Regexp greSOR_1 = regexp2 "^([0-9]+)?(\\.([0-9]+))?$"
Regexp greSOR_2 = regexp2 "^0*$"
 
string fStringOfReal(real rInput, int iDesiredPrecision, bool bTruncateZeros){
        real rPrecision = (exp ((realOf iDesiredPrecision) * 2.302585092994046))
        real rToBeRounded = rInput * rPrecision
        if rToBeRounded < 2147483646.5 and rToBeRounded > -2147483647.5 then  
           rInput = (realOf (intOf rToBeRounded))/rPrecision
        string sInput = rInput ""
 
 
        if(greSOR_1 sInput){
                int iEndFactionalPart = start 2
                if(iEndFactionalPart >= 0){
                        iEndFactionalPart += iDesiredPrecision+1
                        if((length sInput) > iEndFactionalPart){
                                        if bTruncateZeros and (greSOR_2 sInput[iEndFactionalPart:]) then{
                                        int i = (length sInput) -1
                                        while (sInput[i : i] == "0") --i;
                                        sInput = sInput[0 : i]
 
                                }
                                else
                                        sInput = sInput[0 : (iEndFactionalPart-1)]
                        }
                        else if(bTruncateZeros){
                                int i = (length sInput) -1
                                while (sInput[i : i] == "0") --i;
                                sInput = sInput[0 : i]
                        }
                        else
                        {
                                        int i = (length sInput) - iEndFactionalPart
                                        if i >= 1 then{
                                                Buffer oBuff = create
                                                oBuff = sInput
                                                for i in i : 1 by -1 do oBuff += "0"
                                                sInput = stringOf oBuff
                                        }
                        }
                }
                else if(bTruncateZeros){
                        int i = (length sInput) -1
                        while (sInput[i : i] == "0") --i;
                        sInput = sInput[0 : i]
                }
                else
                {
                        Buffer oBuff = create
                        oBuff = sInput
                        oBuff += "."
                        int i
                        for i in iDesiredPrecision : 1 by -1 do oBuff += "0"
                        sInput = stringOf oBuff
                }
                        
        }
 
        return sInput
                
}
 
 
 
 
real average (int j)
{
        real sum = 0 
        real ave = 0
        
        for (i=1;i<=NBITER;i++) {
                sum += (real get(results, i, j))
        }
        ave = sum / realOf(NBITER)
        return (ave)
}    
 
 
  
/***************************/
/**         MAIN           */
/***************************/ 
void main() {}
 
 
// Log file
 
if (LOG) {
        logfile = append ("\\\\Dncs39\\doors_dxl\\admins\\addins\\Admin\\Metrics\\doorslog_performance_results.txt")
        logfile << stringOf dateAndTime(today) "\n"
} 
 
/** Run the benchmarks **/
int i
for (i=1;i<=NBITER;i++) {
 
        step = 1
        put (results, (real benchmarkFileOpenShare ("/Demo Projects/Development Area/Benchmark/Component Test Cases")), i, step)
        
        step++
        put (results, (real benchmarkLoadView ("100 - Export View")), i, step)
        step++
        put (results, (real benchmarkFileSave), i, step)
        step++
        put (results, (real benchmarkFileClose), i, step)
 
        if (i == 1) {
        /** Display first line of table with headings **/
        printOut "Step:"
        for (j=1;j<=step;j++) {
                        printOut "\t" (string get(results,0,j)) ""
                }
        printOut "\n"
        }
 
        /** Display results **/
        for (j=1;j<=step;j++) {
                        real res = (real get(results, i, j))
                        printOut "\t" fStringOfReal(res, 2, false) ""
                }
        printOut "\n"
 
}    // Endof loop on iterations
 
 
 
/* Compute min, max, average */
 
if (STAT) {
        printOut "Ave:"
        for (j=1;j<=step;j++) {
                printOut "\t" fStringOfReal(average(j), 2, false) ""
        }
 
}
 
if (LOG) {
        logfile << "\n" stringOf dateAndTime(today) "\n\n"
        close (logfile)
}

sdauphin - Tue Apr 03 10:59:10 EDT 2012

Re: DOORS Performance Benchmark
llandale - Tue Apr 03 11:46:40 EDT 2012

I'm guessing.
[1] The Open makes use of temporary files, and the more open's you do the more such files there are and the more time it takes to open.
[2] Sending output directly to a Stream (and also printing) steadily makes things slower and slower. printOut() should instead just put the output += into some globabl buffer, and when you are done then send the contents to the output file.

-Louie

Re: DOORS Performance Benchmark
SystemAdmin - Thu Apr 05 03:15:29 EDT 2012

Hi,

You should also take into account memory usage ... Each time you allocate memory (for example by using strings) that is not (or can't not be) deallocated, the overall process size increase, and if the process start to swap, the performance is decreasing. Also when the memory size is high, allocating more memory take more time.

luc

Re: DOORS Performance Benchmark
Mathias Mamsch - Sun Apr 08 17:12:31 EDT 2012

You might also have a problem with your allocations,which makes your program slower. The 'fStringOfReal' function leaks its buffers. Therefore with every iteration you will get more and more objects allocated, which will drastically slow down every function that needs to allocate and deallocate memory. Therefore I would suggest that you either try to wrap the benchmark in an eval_ call just to make sure that the long running DXL performance benchmark program will have no effect on the benchmark operation itself or at least resolve the leaks.

Maybe that helps, Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: DOORS Performance Benchmark
llandale - Tue Apr 10 11:08:15 EDT 2012

Mathias Mamsch - Sun Apr 08 17:12:31 EDT 2012
You might also have a problem with your allocations,which makes your program slower. The 'fStringOfReal' function leaks its buffers. Therefore with every iteration you will get more and more objects allocated, which will drastically slow down every function that needs to allocate and deallocate memory. Therefore I would suggest that you either try to wrap the benchmark in an eval_ call just to make sure that the long running DXL performance benchmark program will have no effect on the benchmark operation itself or at least resolve the leaks.

Maybe that helps, Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Uour leak is gone when you move one "Buffer oBuff = create" to the top and delete the other one, and add "delete(oBuff)" at the bottom.

Re: DOORS Performance Benchmark
sdauphin - Fri Apr 13 10:54:01 EDT 2012

Thanks for your replies.

I have tried all your suggestions : fix the buffer leak, output to a buffer, use the eval_ function, and I have simplified the script to keep only essential commands. I am still getting similar results, with the same increasing plot shape.

Well, it seems to show that the problem is not coming from the way I do the measurement. This is what I wanted to verify.

Thanks for your help,

Servanne.

Re: DOORS Performance Benchmark
SamLund - Tue Jul 03 05:44:57 EDT 2012

First of all, sorry for being late in replying...

Each time you are opening a module in some Edit mode (shared/exclusive), DOORS will write an entry into that module's session log. Session log is not cut or reset by baselining the module, but will remain there as long as the module exists.

Given the time, and increased size of this session log, you will experienced fairly linearily growing delay in opening the module.

Most likely, your performance evaluation is affected (also) by this aspect.

Re: DOORS Performance Benchmark
llandale - Tue Jul 03 15:32:40 EDT 2012

SamLund - Tue Jul 03 05:44:57 EDT 2012
First of all, sorry for being late in replying...

Each time you are opening a module in some Edit mode (shared/exclusive), DOORS will write an entry into that module's session log. Session log is not cut or reset by baselining the module, but will remain there as long as the module exists.

Given the time, and increased size of this session log, you will experienced fairly linearily growing delay in opening the module.

Most likely, your performance evaluation is affected (also) by this aspect.

That little amount of data is unlikely to be detectable. I'm confident that if the test was run again, the results would be about the same.